package com.bubblegumproject.ogo.tx;

import javax.persistence.EntityManager;

/**
 * Represents the current transaction that is associated with a thread-of-control in the component model.
 *
 * @author Azubuko Obele (buko.obele@gmail.com)
 */
public class CurrentTransaction {

    private EntityManager em;

    public CurrentTransaction(EntityManager em) {
        assert(em != null);
        this.em = em;
    }

    EntityManager getEntityManager() {
        return em;
    }

    public void setRollbackOnly() {
        em.getTransaction().setRollbackOnly();
    }
}
